import React, { PureComponent } from 'react';
import {
    View,
    Text,
    TouchableHighlight,
    StyleSheet,
    FlatList
} from 'react-native'
export default class DataList extends PureComponent {
    constructor(props) {
        super(props);
    }
   
    _keyExtractor = (item, index) => item.RECID.toString()
    render() {
        const height = this.props.itemHeight
        return (
            <FlatList
                data={this.props.data}
                renderItem={this.props.renderItem}
                getItemLayout={(data, index) => ( {length: height, offset: height * index, index} )}
                // keyExtractor = {this._keyExtractor}
                onEndReached={this.props.LoadMore}
                onEndReachedThreshold={0.1}
                refreshing={this.props.loading}
                ListFooterComponent={this.props.footer}
            />
        )
    }
}